#!/usr/bin/php
<?php
//               _    _
//    __   _____| | _| |_ ___  _ __ _ __ __ _ _   _ _ __ ___
//    \ \ / / _ \ |/ / __/ _ \| '__| '__/ _` | | | | '_ ` _ \
//     \ V /  __/   <| || (_) | |  | | | (_| | |_| | | | | | |
//      \_/ \___|_|\_\\__\___/|_|  |_|  \__,_|\__,_|_| |_| |_|
//
//    checkpassword-oath

// Verify correct usage
if($argc!=3) {
    echo "usage: checkpassword_verify.php username password\n";

    exit(1);
}

// deactivate execution of the script
$dont_authorize = true;

// Include file and supress output
ob_start();
@require('checkpassword.php');
ob_clean();

$result = $checkPass->verify($argv[1], $argv[2]);

if($result==$config['return_valid']) {
    echo "ok\n";
} else {
    echo "invalid\n";
}

exit($result);

?>
